<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('表单推送历史列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>名称：</label>
                                <select name="formId" class="form-control">
                                    <option value="">所有</option>
                                    <option  th:each="item:${formInfoList}" th:text="${item.channelName}" th:value="${item.id}"></option>
                                </select>
                            </li>
                            <li>
                                <label>用户ID：</label>
                                <input type="text" name="uid" autocomplete="off"/>
                            </li>
                            <li>
                                <label>渠道名称：</label>
                                <div class="col-sm-2" >
                                    <select name="channelCode" class="form-control">
                                        <option value="">所有</option>
                                        <option  th:each="item:${formInfoList}" th:text="${item.channelName}" th:value="${item.id}" ></option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>推送结果：</label>
                                <div class="col-sm-2" >
                                    <select class="form-control"  name="pushResult">
                                        <option value="">所有</option>
                                        <option value="SUCCESS">成功</option>
                                        <option value="FAILED">失败</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>推送类型：</label>
                                <div class="col-sm-2" >
                                    <select class="form-control"  name="pushType">
                                        <option value="">所有</option>
                                        <option value="SYS">系统</option>
                                        <option value="MANUAL">手动</option>
                                    </select>
                                </div>
                            </li>
                            <li>
                                <label>入库时间：</label>
                                <input type="text" name="userCreateTime" id="userCreateTime" autocomplete="off"/>
                            </li>
                            <li>
                                <label>推送时间：</label>
                                <input type="text" name="createTime" id="createTime" autocomplete="off"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

<!--            <div class="btn-group-sm" id="toolbar" role="group">-->
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="form:his:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="form:his:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="form:his:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="form:his:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
<!--            </div>-->
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('form:his:edit')}]];
        var removeFlag = [[${@permission.hasPermi('form:his:remove')}]];
        var prefix = ctx + "form/his";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                detailUrl: prefix + "/detail/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "表单推送历史",
                columns: [
                //     {
                //     checkbox: true
                // },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                // {
                //     field: 'channelType',
                //     title: '渠道类型'
                // },
                {
                    field: 'channelName',
                    title: '名称'
                },
                {
                    field: 'uid',
                    title: '用户ID',
                    formatter: function (value,row,index){
                        var result = '<span style="color: #1c84c6; border-bottom: 1px solid" onclick="memberInfoView(\''+row.uid+'\')">'+row.uid+'</span>';
                        return result;
                    }
                },
                {
                    field: 'usernameStr',
                    title: '姓名'
                },
                {
                    field: 'mobileStr',
                    title: '手机号'
                },
                {
                    field: 'nameInfo',
                    title: '渠道名称'
                },
                // {
                //     field: 'channelCode',
                //     title: '用户渠道'
                // },
                // {
                //     field: 'pushKey',
                //     title: '推送信息'
                // },
                {
                    field: 'pushType',
                    title: '推送类型'
                },
                    {
                        field: 'userCreateTime',
                        title: '入库时间'
                    },
                {
                    field: 'pushResult',
                    title: '推送结果',
                    formatter: function (value, row, index){
                        return row.pushResult === 'SUCCESS'?"成功":"失败";
                    }
                },
                // {
                //     field: 'retCode',
                //     title: '返回码'
                // },
                {
                    field: 'createTime',
                    title: '推送时间'
                },
                {
                    field: 'retCode',
                    title: '返回信息'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-primary btn-xs "  onclick="$.operate.detailUrl(\'' + row.id + '\')"><i class="fa fa-info"></i>详情</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
                ]
            };
            $.table.init(options);
        });

        layui.use('laydate', function(){
            var laydate = layui.laydate;

            laydate.render({
                elem: '#createTime',
                type: 'datetime',
                range: '~'
            });

            laydate.render({
                elem: '#userCreateTime',
                type: 'datetime',
                range: '~'
            });

        });

        function memberInfoView(uid){
            var url = ctx + "member/info/view/" + uid;
            $.modal.open('用户详情', url);
        }
    </script>
</body>
</html>